// 系统配置
var config = {
    baseUrl:"http://121.42.165.44/ksd-app/",
    //baseUrl:"http://47.94.22.93:8080/ksd-app/",

    // 保存登录人信息
    saveUser:function(userString){
        window.sessionStorage.setItem("user", userString);
    },

    // 登录人userId
    getUserId:function() {
        var user = JSON.parse(window.sessionStorage.getItem("user"));
        var userId = user!=null ?user.id:window.location.href = "login.html";// '26e0bbf545084a248cc56a386577d1e8'
        return userId;
    },
    // 用户级别
    userClass: function(valeu) {
        var result='';
        switch (valeu) {
            case 0:result = "普通会员"; break;
            case 1:result = "一星会员"; break;
            case 2:result = "二星会员"; break;
            case 3:result = "三星会员"; break;
            case 4:result = "四星会员"; break;
            case 5:result = "五星会员"; break;
            case 99:result = "运营中心"; break;
            case 80:result = "钻石会员"; break;
            case 81:result = "金钻会员"; break;
            case 82:result = "宝石会员"; break;
            default: result="级别有误";
        }
        return result;
    },
    // 账户名称
    accountType:function(value) {
        var result='';
        switch (value) {
            case 0:result = "总积分"; break;
            case 1:result = "商融卡"; break;
            case 2:result = "产品积分"; break;
            case 3:result = "奖励积分"; break;
            case 4:result = "消费商"; break;
            case 5:result = "购物积分"; break;
            case 6:result = "消费券"; break;
            case 7:result = "冻结积分"; break;
            case 8:result = "福利点"; break;
            case 9:result = "合世积分"; break;
            case 10:result = "公益基金"; break;
            case 11:result = "业务经理"; break;
            case 12:result = "区域经理"; break;
            case 13:result = "大区经理"; break;
            case 21:result = "大区经理商融卡"; break;
            case 23:result = "大区经理奖励"; break;
            case 24:result = "大区经理"; break;
            case 31:result = "商融卡资产包"; break;
            case 32:result = "奖励积分资产包"; break;
            case 33:result = "消费商资产包"; break;
            case 88:result = "省代账户"; break;
            default: result="账户类型有误";
        }
        return result;
    },
    // 地址是否是默认
    defaultAddressFlag: function(value) {
        var result = "";
        switch (value) {

            case 0:result = "否"; break;
            case 1:result = "是"; break;
            default: result="数据有误";
        }
        return result;
    },
    // 日期格式化
    formateDate: function(data, format) {
        return moment(data).format(format);
    }
}
